package com.ahwei.product.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 这是一个Java文件！
 * </p>
 *
 * @author ahWei
 * @email：ahwei163@qq.com
 * @since 2022-06-01 14:50:19
 */
@RestController
@RefreshScope
public class NacosConfigController {

    /**
     * @Value注入nacos配置中的数据
     */
    @Value("${spring.datasource.url}")
    private String datasourceUrl;

    @GetMapping("/datasourceUrl2")
    public String datasourceUrl() {
        return datasourceUrl;
    }
}